#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#if 0
int main()
{
	FILE* pf = fopen("text.txt", "r");
	if (pf == NULL)
	{
		perror("fopen");
		return 1;
	}
	int ch = 0;
	while ((ch = fgetc(pf)) != EOF)
	{
		printf("%c", ch);
	}
	fclose(pf);
	pf = NULL;
	return 0;
}
#endif
#if 0
int main()
{
	FILE* pf = fopen("text.txt", "w");
	if (pf == NULL)
	{
		perror("fopen");
		return 1;
	}
	fputs("hello world\n", pf);
	fputs("hello bit\n", pf);
	fclose(pf);
	pf = NULL;
	return 0;
}
#endif
#if 0
int main()
{
	FILE*pf=fopen("text.txt", "r");
	if (pf == NULL)
	{
		perror("fopen");
		return 1;
	}
	char arr[20] = "xxxxxxxxxxxxxxxx";
	fgets(arr, 20, pf);
	printf("%s", arr);
	fgets(arr, 20, pf);
	printf("%s", arr);
	fclose(pf);
	pf = NULL;
	return 0;
}
#endif
int main()
{
	FILE*pf=fopen("text.txt", "r");
	if (pf == NULL)
	{
		perror("fopen");
		return 1;
	}
	char arr[20] = { 0 };
	while (fgets(arr, 20, pf) != NULL)
	{
		printf("%s", arr);
	}
	fclose(pf);
	pf = NULL;
	return 0;
}